<?php
/**
 *      [迷你云] (C)2009-2012 南京恒为网络科技.
 *   软件仅供研究与学习使用，如需商用，请访问www.miniyun.cn获得授权
 * 
 */
?>
<?php


class MusicList extends FillBase
{
    
    public function obtainMusicList($user_id, $limit = 45, $start = 0){
        $list =  UserFile::model()->findAllBySql("SELECT * FROM ".Yii::app()->params['tablePrefix']."files WHERE user_id=".$user_id." and is_deleted != 1 and version_id in(select id from ".Yii::app()->params['tablePrefix']."file_versions where mime_type like 'audio%') ORDER BY created_at desc limit ".$start.", ".$limit);
		$data =  $this->filFillList($list);
        return $data;
    }
    
     
    public function musicCount($user_id){
    	$data = UserFile::model()->countBySql("SELECT count(*) FROM ".Yii::app()->params['tablePrefix']."files WHERE user_id=".$user_id." and is_deleted != 1 and version_id in(select id from ".Yii::app()->params['tablePrefix']."file_versions where mime_type like 'audio%')");
    	return $data;
    }
}
?>